package jedis;

import org.msgpack.MessagePack;
import redis.clients.jedis.Jedis;
import java.io.IOException;

/**
 * jedis序列化示例
 */
public class SerizlizableDemo {
    public static void main(String[] args) throws IOException {
        Jedis jedis = new Jedis("192.168.10.100", 6379);
        jedis.auth("Bocon123456*");


        Club club = new Club();
        club.setCode("AC");
        club.setName("米兰");


        MessagePack msgpack = new MessagePack();
        msgpack.register(Club.class);
        byte[] writeData = msgpack.write(club);

        jedis.set("masterClub".getBytes(), writeData);

        byte[] readData = jedis.get("masterClub".getBytes());

        Club masterClub = msgpack.read(readData, Club.class);
        System.out.println(masterClub);

    }
}
